#include <RMTT_Libs.h>
#include <Wire.h>
#define REG_00H 0x00       
#define REG_01L 0x00  
unsigned int Dist = 0;   //定义存放TOF250距离值的变量
int address;
int getTOF(int aaa) {
  address=aaa;
  char i = 0;
  byte rx_buf[2] = {0};
  Wire.beginTransmission(address);    
  Wire.write(REG_00H);               //向TOF250 00H地址开始要求获取数据
  Wire.endTransmission();             
  Wire.requestFrom(address, 2);      //读取2个byte长度的数据

  while ( Wire.available())
  {
    rx_buf[i] = Wire.read();         //每次接收一个byte的数据
    i++;
    if (i >= 2)
    {
      i = 0;
      Dist = rx_buf[0] * 256 + rx_buf[1]; //高8位数据
    }
  }
  return Dist;
 // Wire.end();//////////////////////shanddddddddddllllllllllllllllll
}
